s = 'Once upon a time, in a land far away, lived a brave knight named Arthur.'
s1 = s.split()  #空格分隔记数
print('故事中的单词数量为：',len(s1))
s2=[]  #存放主人公名字位置
#print(s1.index('tom'))  只能找到第一个名字
for i in range(len(s1)):
    if s1[i] == 'Arthur.':
        print(f'主人公名字在第{i+1}位。')
        s2.append(i)
for i in s2:
    s1[i] = 'wangjiahe'

for i in range(len(s1)):
    print(s1[i],end=' ')
print()
print(s.upper())
print(s.lower())
